import { Alert } from "solid-fire-controls"
import { Component, Show } from "solid-js"

export interface ErrorMessageProps {
  error?: Error,
  show?: boolean
}

const ErrorMessage: Component<ErrorMessageProps> = (props) => {
  return <Show when={props.show}>
    <Alert canClose variant="danger">
      {props.error?.message ?? props.error?.toString()}
    </Alert>
  </Show>
}

export default ErrorMessage
